package cn.schoolwow.quickdao.module.database.ddl.query.service.index;

import cn.schoolwow.quickdao.domain.database.parent.DatabaseType;
import cn.schoolwow.quickdao.module.database.ddl.query.flow.index.getEntityIndexFlow.*;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;

public class GetEntityIndexFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        DatabaseType databaseType = flowContext.checkInstanceData(DatabaseType.class);

        flowContext.putTemporaryData("name", "获取指定表索引信息");
        switch (databaseType){
            case H2:{
                flowContext.executeFlowList(new GetEntityIndexByH2Flow());
            }break;
            case SQLite:{
                flowContext.executeFlowList(new GetEntityIndexBySQLiteFlow());
            }break;
            case Mysql:
            case MariaDB:{
                flowContext.executeFlowList(new GetEntityIndexByMySQLFlow());
            }break;
            case Postgresql:{
                flowContext.executeFlowList(new GetEntityIndexByPostgresFlow());
            }break;
            case SQLServer:{
                flowContext.executeFlowList(new GetEntityIndexBySQLServerFlow());
            }break;
            case Oracle:{
                flowContext.executeFlowList(new GetEntityIndexByOracleFlow());
            }break;
        }
    }

    @Override
    public String name() {
        return "获取数据库索引字段信息";
    }

}
